package thefirst.controller;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import thefirst.LessonBoard.model.LessonBoardService;
import thefirst.member.model.MemberService;
import thefirst.support.model.NoticeService;
import thefirst.support.model.NoticeVO;

@Controller
public class LayoutController {
	@Resource(name="noticeServiceImpl")
	private NoticeService noticeService;
	@Resource(name="memberServiceImpl")
	private MemberService memberService;
	@Resource(name="lessonBoardServiceImpl")
	private LessonBoardService lessonBoardService;
	@RequestMapping("/main.do")
	public ModelAndView support(HttpServletRequest request,HttpServletResponse response) throws Exception{
		System.out.println("main");
		HashMap map=new HashMap();
		map.put("notice", noticeService.getNoticeListForLeft());
		map.put("student",memberService.getStudentListForLeft());
		map.put("teacher", memberService.getTeacherListForLeft());
		map.put("lessonBoard", lessonBoardService.getLessonBoardListForMain());
		return new ModelAndView("home","map", map);
	}
	@RequestMapping("/admin.do")
	public String admin(HttpServletRequest request,HttpServletResponse response) throws Exception{
		System.out.println("admin");
		return "admin";
	}
	@RequestMapping("/support.do")
	public String supportMain(HttpServletRequest request, HttpServletResponse response) throws Exception{
		return "support/support.support";
	}
	
	public String moveWriteNotice(HttpServletRequest request, HttpServletResponse response) throws Exception{
		return "support/writeNotice.notice";
	}
	/*@RequestMapping("/noticeList.do")
	public String noticeList(HttpServletRequest request, HttpServletResponse response) throws Exception{
		return "support/notice/notice.notice";
	}*/
}
